﻿<div class="my-main">
    <div class="ui-box  ui-box-alpha">
        <div class="ui-box-head">
            <div class="ui-box-head-border">
                <div class="ui-box-head-title">
                    安全中心</div>
                <span class="ui-box-head-text">修改密码</span> <a href="#" class="ui-box-head-more">
                </a>
            </div>
        </div>
        <div class="ui-box-container">
            <div class="ui-box-content">
                <div class="ui-tiptext-container ui-tiptext-container-message">
                    <p class="ui-tiptext ui-tiptext-message">
                        <i class="ui-tiptext-icon iconfont" title="提示"></i> 密码格式为：至少两个字母、两个数字、一个特殊字符！（字母区分大小写）。
                    </p>
                </div>
            </div>
        </div>
        <div class="ui-box-container-noborder">
            <form id="form-change-password" class="form-horizontal" method="post" action="/security/changepassword">
            <div class="form-content">
                <div class="control-group">
                    <label class="control-label" for="oldPassword">
                        原 密 码：</label>
                    <div class="controls">
                        <input type="password" id="oldPassword" name="oldPassword" maxlength="12" placeholder="请输入原密码">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="newPassword">
                        新 密 码：</label>
                    <div class="controls">
                        <input type="password" id="newPassword" name="newPassword" maxlength="12" placeholder="请输入新密码">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="confirmPassword">
                        确认密码：</label>
                    <div class="controls">
                        <input type="password" id="confirmPassword" name="confirmPassword" maxlength="12"
                            placeholder="请再次输入新密码">
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <button class="ui-btn ui-btn-alpha" type="submit">
                    保 存</button>
                <button type="reset" class="ui-btn ui-btn-beta">
                    取 消</button>
            </div>
            </form>
        </div>
    </div>
</div>
@section css{
}
@section js{
    <script type="text/javascript">
        $(function () {
            $("#form-change-password").validate({
                rules: { 'oldPassword': { required: true, password: false }, 'newPassword': { required: true, password: true }, 'confirmPassword': { required: true, password: true, equalTo: '#newPassword'} },
                messages: { 'oldPassword': { required: '请输入原密码！' }, 'newPassword': { required: '请输入新密码！', password: '请输入符合格式的密码！' }, 'confirmPassword': { required: '请输入新密码！', password: '请输入符合格式的密码！', equalTo: '确认密码与新密码不一致！'} },
                submitHandler: function (form) {
                    var param = $(form).serialize();
                    $.postJSON(form.action, param, function (result) {
                        if (result.Status == true) {

                        } else {
                            alert(result.Message);
                        }
                    });
                    return false;
                }
            });
        });
    </script>
}
